package TestMain;

import ALBasicServer.ALBasicMutex.MutexAtom;
import ALBasicServer.ALProcess.ALProcess;
import ALBasicServer.ALProcess._IALProcessAction;
import ALBasicServer.ALServerSynTask.ALSynTaskManager;
import ALBasicServer.ALTask._IALSynTask;
import ALServerLog.ALServerLog;

public class TestProcessTask implements _IALSynTask
{
	private String _m_sName;
	
	public TestProcessTask(String _name)
	{
		_m_sName = _name;
	}

	@Override
	public void run() 
	{
		ALProcess testProcess = ALProcess.CreateProcess("root");
		final ALProcess testProcess_sub1 = ALProcess.CreateProcess("sub1");
		final ALProcess testProcess_sub11 = ALProcess.CreateProcess("sub11");
		final ALProcess testProcess_sub2 = ALProcess.CreateProcess("sub2");
		
		testProcess_sub1.addActionProcess(new _IALProcessAction() {
			
			@Override
			public void dealAction() {
				ALServerLog.Sys("test_sub1 process");

				ALServerLog.Sys(testProcess_sub1.getFullProcessTag());
			}
		});
		testProcess_sub1.addProcess(testProcess_sub11);

		testProcess_sub11.addActionProcess(new _IALProcessAction() {
			
			@Override
			public void dealAction() {
				ALServerLog.Sys("test_sub11 process");

				ALServerLog.Sys(testProcess_sub11.getFullProcessTag());
			}
		});

		testProcess_sub2.addActionProcess(new _IALProcessAction() {
			
			@Override
			public void dealAction() {
				ALServerLog.Sys("test_sub2 process");

				ALServerLog.Sys(testProcess_sub2.getFullProcessTag());
			}
		});

		testProcess.addProcess(testProcess_sub1);
		testProcess.addProcess(testProcess_sub2);
		
		testProcess.dealAction();
	}

}
